//=============================================================================

#include "../inc/aRenderStatic.h"
#include "../inc/msgs.h"

//=============================================================================

aRenderStatic::aRenderStatic()
{
}

//=============================================================================

void aRenderStatic::arSetWnd(HWND h)
{
  ownedWnd = h;
}

//=============================================================================

BEGIN_MESSAGE_MAP(aRenderStatic, CStatic)
  ON_WM_LBUTTONDOWN()
  ON_WM_LBUTTONUP()
  ON_WM_MOUSEMOVE()
  ON_WM_RBUTTONDOWN()
  ON_WM_RBUTTONUP()
  ON_WM_MBUTTONDOWN()
  ON_WM_MBUTTONUP()
  ON_WM_MOUSEWHEEL()
END_MESSAGE_MAP()

//=============================================================================

void aRenderStatic::OnLButtonDown(UINT flags, CPoint point)
{
  if (!ownedWnd)
    return;

  ::SendMessage(ownedWnd, RENDER_LMD, 0, 0);
}

//=============================================================================

void aRenderStatic::OnLButtonUp(UINT flags, CPoint point)
{
  if (!ownedWnd)
    return;

  ::SendMessage(ownedWnd, RENDER_LMU, 0, 0);
}

//=============================================================================

void aRenderStatic::OnMouseMove(UINT flags, CPoint point)
{
  if (!ownedWnd)
    return;

  ::SendMessage(ownedWnd, RENDER_MM, point.x, point.y);
}

//=============================================================================

void aRenderStatic::OnRButtonDown(UINT flags, CPoint point)
{
  if (!ownedWnd)
    return;

  ::SendMessage(ownedWnd, RENDER_RMD, point.x, point.y);
}

//=============================================================================

void aRenderStatic::OnRButtonUp(UINT flags, CPoint point)
{
  if (!ownedWnd)
    return;

  ::SendMessage(ownedWnd, RENDER_RMU, point.x, point.y);
}

//=============================================================================

void aRenderStatic::OnMButtonDown(UINT flags, CPoint point)
{
  if (!ownedWnd)
    return;

  ::SendMessage(ownedWnd, RENDER_MMD, point.x, point.y);
}

//=============================================================================

void aRenderStatic::OnMButtonUp(UINT flags, CPoint point)
{
  if (!ownedWnd)
    return;

  ::SendMessage(ownedWnd, RENDER_MMU, point.x, point.y);
}

//=============================================================================

BOOL aRenderStatic::OnMouseWheel(UINT flags, short zDelta, CPoint pt)
{
  if (!ownedWnd)
    return FALSE;

  ::SendMessage(ownedWnd, RENDER_MWM, zDelta, zDelta);

  return TRUE;
}

//=============================================================================
